package com.mangofactory.aop.joinpoints
{
	import org.as3commons.bytecode.interception.InvocationKind;
	import com.mangofactory.aop.aspects.Aspect;
	
	public class AspectInvokingJoinPoint implements ProceedingJoinPoint
	{
		private var aspect:Aspect;
		private var nextJoinPoint:ProceedingJoinPoint;
		public function AspectInvokingJoinPoint(aspect:Aspect,nextJoinPoint:ProceedingJoinPoint)
		{
			this.aspect = aspect;
			this.nextJoinPoint = nextJoinPoint;
		}
		
		public function proceed():void
		{
			aspect.intercept(nextJoinPoint);
		}
		
		public function get kind():InvocationKind
		{
			return nextJoinPoint.kind;
		}
		
		public function get arguments():Array
		{
			return nextJoinPoint.arguments;
		}
		
		public function get targetInstance():Object
		{
			return nextJoinPoint.targetInstance;
		}
		
		public function get targetMember():QName
		{
			return nextJoinPoint.targetMember;
		}

		public function get returnValue():*
		{
			return nextJoinPoint.returnValue;
		}

		public function set returnValue(value:*):void
		{
			nextJoinPoint.returnValue = value;
		}
	}
}